<template>
    <div class="send-page" v-if="showSend">
        <div class="send-content">
            <div class="send-top">
                <span class="item" v-for="(item,index) in fastMsg" :key="index" @click="changeTxt(index)">{{item}}</span>
            </div>
            <div class="send-inp">
                <div class="inp-top">
                    <!-- <span class="emox">1</span>
                    <span class="emox">2</span>
                    <span class="emox">3</span>
                    <span class="emox">4</span>
                    <span class="emox">5</span>
                    <span class="emox">6</span>
                    <span class="emox">7</span>
                    <span class="emox">8</span>
                    <span class="emox">9</span>
                    <span class="emox">10</span> -->
                </div>
                <div class="inp">
                    <input type="text" v-todo-focus  placeholder="喜欢就评论" v-model="txt"><span @click="send">发送</span>
                </div>
            </div>
            <div class="close" @click="close">
                <img src="../assets/images/叉叉.png" alt="">
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props:['userComlists'],
        data() {
            return {
                showSend: true,
                flag:null,
                txt:'',
                userId:null,
                fastMsg:['做的真棒','学习了！谢谢','亲爱的，你真厉害！','看着好吃'],//快捷回复数据
            };
        },
        methods: {
            close(){
                this.showSend=false
                this.$emit('close',this.showSend);
            },
            send(){
                this.$emit("send",this.txt)
                this.txt=''
            },
            //快捷回复
            changeTxt(index){
                this.txt = this.fastMsg[index]
            }
        },
         // 自定义指令
        directives:{
          "todo-focus":{     
            inserted:function(el){      
              // 获取焦点
              el.focus()
            }
          }
        },
    }
</script>

<style lang="less" scoped>
.send-page{
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 1001;

    .send-content{
        height: 150px;
        width: 100%;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 888;
        background-color: #fff;
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;
        overflow: hidden;
        .send-top{
            padding: 10px 10px 0 10px;
            margin-bottom: 10px;
            .item{
                display: inline-block;
                padding: 5px 8px;
                background-color: #f2f2f2;
                border-radius: 20px;
                letter-spacing: 0.8px;
                font-size: 12px;
                margin: 5px 12px;
            }
        }
        .send-inp{
            background-color: #f2f2f2;
            .inp-top{
                padding: 3px 10px 10px 10px;
                text-align: center;
                display: flex;
                justify-content: space-evenly;
                .emox{
                    display: inline-block;
                    font-size: 12px;
                }
            }
            .inp{
                padding-bottom: 18px;
                display: flex;
                justify-content: center;
                align-items: center;
                &>input{
                    width: 75%;
                    padding: 10px 10px;
                    font-size: 12px;
                    letter-spacing: 0.8px;
                    border-top-left-radius: 20px;
                    border-bottom-left-radius: 20px;
                    border: none;
                    outline: none;
                }
                &>span{
                    padding: 12px 12px;
                    border-top-right-radius: 20px;
                    border-bottom-right-radius: 20px;
                    background-color: #ffc000;
                    font-size: 12px;
                    color: #fff;
                    font-weight: bold;
                    letter-spacing: 0.6px;
                }
            }
        }
        .close{
            position: absolute;
            top: 5px;
            right: 10px;
            &>img{
                width: 25px;
                height: 25px;
            }
        }
    }
}
</style>